<?php

namespace common\services\backend;

use Yii;
use yii\web\NotFoundHttpException;
use yii\web\UnprocessableEntityHttpException;
use yii\helpers\Json;
use common\services\BaseService;
use common\helpers\ArrayHelper;
use common\models\DdMenuCate;

/**
 * Class SmsService
 * @package common\services\backend
 * @author chunchun <2192138785@qq.com>
 */
class TopnavService extends BaseService
{
    public function getnav()
    {
        $menucate = DdMenuCate::find()->orderBy('sort')->asArray()->all();
        foreach ($menucate as $key => &$value) {
            $value["text"] = $value['name'];
            $value["icon"] = $value['icon'];
            $value["targetType"] = "top-nav";
            $value["url"] = "system/welcome/{$value['mark']}";
        }
        return json_encode($menucate, JSON_UNESCAPED_UNICODE);
        // return $menucate;
    }
}
